import type { Node } from '@vue-flow/core';
import { Position } from '@vue-flow/core';

export const getDefaultLabel = (type: string): string => {
  const labelMap: Record<string, string> = {
    start: '开始',
    end: '结束',
    task: '处理节点',
    inclusive: '包容网关',
    exclusive: '排他网关',
    parallel: '并行网关'
  };

  return labelMap[type] || '节点';
};

export const getNodeStyle = (type: string): Partial<Node> => {
  switch (type) {
    case 'start':
      return {
        style: { backgroundColor: '#ff7b7b', width: '60px', height: '60px', borderRadius: '50%', border: 0 },
        sourcePosition: Position.Right,
        targetPosition: Position.Left
      };
    case 'end':
      return {
        style: { backgroundColor: '#ff7b7b', width: '60px', height: '60px', borderRadius: '50%', border: 0 },
        sourcePosition: Position.Right,
        targetPosition: Position.Left
      };
    case 'task':
      return {
        style: { backgroundColor: '#7bafff', width: '120px', height: '60px', borderRadius: '4px', border: 0 },
        sourcePosition: Position.Right,
        targetPosition: Position.Left
      };
    case 'inclusive':
    case 'exclusive':
    case 'parallel':
      return {
        style: { backgroundColor: '#7bff8f', width: '60px', height: '60px', transform: 'rotate(45deg)', border: 0 },
        sourcePosition: Position.Right,
        targetPosition: Position.Left
      };
    default:
      return {};
  }
};
